
<?php echo $this->fetch('pageheader.htm'); ?>
<div class="main-div">
<form method="post" action="users.php" name="theForm" onsubmit="return validate()">
<table width="100%" >
  <tr>
    <td class="label">User Name:</td>
    <td><input type="text" name="user_name" maxlength="60" value="<?php echo $this->_var['user']['user_name']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Email:</td>
    <td><input type="text" name="email" maxlength="60" size="40" value="<?php echo $this->_var['user']['email']; ?>" /><?php echo $this->_var['lang']['require_field']; ?></td>
  </tr>
  <tr>
    <td class="label" name="user_type">User Type:</td>
	<td><select id="user_type" name="user_type">
			<?php $_from = $this->_var['user_type']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'type');if (count($_from)):
    foreach ($_from AS $this->_var['type']):
?>
			<option value="<?php echo $this->_var['type']['mid']; ?>"><?php echo $this->_var['type']['name']; ?></option>
			<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			</select>
			<script>
				document.getElementById("user_type").value="<?php echo $this->_var['user']['user_type']; ?>";
			</script>
            </td>
  </tr>
  <tr>
    <td class="label">Gender:</td>
    <td><select id="gender_type" name="gender_type">
			<?php $_from = $this->_var['gender_type']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'type');if (count($_from)):
    foreach ($_from AS $this->_var['type']):
?>
			<option value="<?php echo $this->_var['type']['xid']; ?>"><?php echo $this->_var['type']['genderType']; ?></option>
			<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			</select>
			<script>
				document.getElementById("gender_type").value="<?php echo $this->_var['user']['sex']; ?>";
			</script>
            </td>
  </tr>
  <tr>
    <td class="label">Register Date:</td>
    <td><?php echo $this->html_select_date(array('field_order'=>'YMD','prefix'=>'birthday','time'=>$this->_var['user']['reg_time'],'start_year'=>'-60','end_year'=>'+1','display_days'=>'true','month_format'=>'%m')); ?></td> 
  </tr>
  <tr>
    <td class="label">Last Login Date:</td>
    <td><?php echo $this->html_select_date(array('field_order'=>'YMD','prefix'=>'birthday','time'=>$this->_var['user']['last_login'],'start_year'=>'-60','end_year'=>'+1','display_days'=>'true','month_format'=>'%m')); ?></td>
  </tr>
  <tr>
    <td class="label">Last IP:</td>
    <td><input type="text" name="last_ip" maxlength="60" value="<?php echo $this->_var['user']['last_ip']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Visit Count:</td>
    <td><input type="text" name="visit_count" maxlength="60" value="<?php echo $this->_var['user']['visit_count']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">First Name:</td>
    <td><input type="text" name="first_name" maxlength="60" value="<?php echo $this->_var['user']['firstname']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Last Name:</td>
    <td><input type="text" name="last_name" maxlength="60" value="<?php echo $this->_var['user']['lastname']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Province:</td>
    <td><input type="text" name="province" maxlength="60" value="<?php echo $this->_var['user']['province']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">City:</td>
    <td><input type="text" name="city" maxlength="60" value="<?php echo $this->_var['user']['address']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Country:</td>
    <td><input type="text" name="country" maxlength="60" value="<?php echo $this->_var['user']['country']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Zip Code:</td>
    <td><input type="text" name="zip_code" maxlength="60" value="<?php echo $this->_var['user']['zipcode']; ?>" /></td>
  </tr>
  <?php if ($this->_var['user']['user_type'] == 2): ?>
  <!--<tr>
    <td class="label">Projects Created:</td>
    <td><input type="text" name="projects_created" maxlength="60" value="<?php echo $this->_var['user']['projectsCreated']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Projects Awarded:</td>
    <td><input type="text" name="projects_awarded" maxlength="60" value="<?php echo $this->_var['user']['projectsAwarded']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Phone:</td>
    <td><input type="text" name="phone" maxlength="60" value="<?php echo $this->_var['user']['phone']; ?>" /></td>
  </tr> -->
  <?php else: ?>
  <!--<tr>
    <td class="label">Experience:</td>
    <td><input type="text" name="experience" maxlength="60" value="<?php echo $this->_var['user']['experience']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Training Service:</td>
    <td><input type="text" name="training_service" maxlength="60" value="<?php echo $this->_var['user']['trainingService']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Training Specialties:</td>
    <td><input type="text" name="training_specialties" maxlength="60" value="<?php echo $this->_var['user']['trainingSpecialties']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Credentials:</td>
    <td><input type="text" name="credentials" maxlength="60" value="<?php echo $this->_var['user']['credentials']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Education Level:</td>
    <td><input type="text" name="education_level" maxlength="60" value="<?php echo $this->_var['user']['eduLevel']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">School:</td>
    <td><input type="text" name="school" maxlength="60" value="<?php echo $this->_var['user']['school']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">Major:</td>
    <td><input type="text" name="major" maxlength="60" value="<?php echo $this->_var['user']['major']; ?>" /></td>
  </tr>
  <tr>
    <td class="label">BIO:</td>
    <td><input type="text" name="BIO" maxlength="60" value="<?php echo $this->_var['user']['BIO']; ?>" /></td>
  </tr> -->
  <?php endif; ?>
  <tr>
    <td colspan="2" align="center">
      <input type="submit" value="Save Change" class="button" />
      <input type="hidden" name="act" value="member_modify" />
      <input type="hidden" name="user_id" value="<?php echo $this->_var['user']['user_id']; ?>" />    
	</td>
  </tr>
</table>

</form>
</div>
<?php echo $this->smarty_insert_scripts(array('files'=>'js/utils.js,validator.js')); ?>

<script language="JavaScript">
<!--

if (document.forms['theForm'].elements['act'].value == "insert")
{
  document.forms['theForm'].elements['username'].focus();
}
else
{
  document.forms['theForm'].elements['email'].focus();
}

onload = function()
{
    // 开始检查订单
    startCheckOrder();
}

/**
 * 检查表单输入的数据
 */
function validate()
{
    validator = new Validator("theForm");
    validator.isEmail("email", invalid_email, true);

    if (document.forms['theForm'].elements['act'].value == "insert")
    {
        validator.required("username",  no_username);
        validator.required("password", no_password);
        validator.required("confirm_password", no_confirm_password);
        validator.eqaul("password", "confirm_password", password_not_same);

        var password_value = document.forms['theForm'].elements['password'].value;
        if (password_value.length < 6)
        {
          validator.addErrorMsg(less_password);
        }
        if (/ /.test(password_value) == true)
        {
          validator.addErrorMsg(passwd_balnk);
        }
    }
    else if (document.forms['theForm'].elements['act'].value == "update")
    {
        var newpass = document.forms['theForm'].elements['password'];
        var confirm_password = document.forms['theForm'].elements['confirm_password'];
        if(newpass.value.length > 0 || confirm_password.value.length)
        {
          if(newpass.value.length >= 6 || confirm_password.value.length >= 6)
          {
            validator.eqaul("password", "confirm_password", password_not_same);
          }
          else
          {
            validator.addErrorMsg(password_len_err);
          }
        }
    }

    return validator.passed();
}
//-->
</script>

<?php echo $this->fetch('pagefooter.htm'); ?>
